package com.sky.aion.redis;

import com.sky.aion.AionConstant;
import com.sky.aion.utils.StatusEnum;
import com.sky.aion.utils.SpeakUtils;
import com.sky.aion.winio.WinIoUtils;
import redis.clients.jedis.JedisPubSub;

public class KeyExpiredListener extends JedisPubSub {
 
    @Override
    public void onPSubscribe(String pattern, int subscribedChannels) {
        /*System.out.println("onPSubscribe "
                + pattern + " " + subscribedChannels);
        System.out.println("初始化！！！");*/
    }
 
    @Override
    public void onPMessage(String pattern, String channel, String message) {
 
        System.out.println("onPMessage message " + message);
        for (StatusEnum statusEnum: StatusEnum.values()){
            if (message.equals(statusEnum.getRedisCode())){
                //自动吃卷轴
                WinIoUtils.execu(statusEnum.getKey());
                //语音提醒
                JedisUtils.rpush(AionConstant.SPEAKLIST,statusEnum.getMsg());
                break;
            }
        }
    }
 
 
 
}
